import Cookies from 'js-cookie'

const TokenKey = 'Api-Token'

const VersionKey = 'Version-Token'

export function getToken() {
    return Cookies.get(TokenKey)
}

export function setToken(token) {
    return Cookies.set(TokenKey, token)
}

export function removeToken() {
    // 清空sessionStorage
    window.sessionStore.clear();
    return Cookies.remove(TokenKey)
}


export function getVersion() {

    console.log("从cookie中获取version")

    return Cookies.get(VersionKey)
}

window.getVersion = function () {
    console.log("从cookie中获取version")

    return Cookies.get(VersionKey)
}

export function setVersion(version) {
    return Cookies.set(VersionKey, version)
}

export function removeVersion() {
    // 清空sessionStorage
    window.sessionStore.clear();
    return Cookies.remove(VersionKey)
}

export function getTip() {
    // 清空sessionStorage
    return Cookies.get("tip")
}

export function setTip(item) {
    // 清空sessionStorage
    return Cookies.set("tip", item)
}
